package com.hktf.corelib.utils;

import android.content.Context;
import android.content.SharedPreferences;

import com.hktf.corelib.jsonbean.PadInfo;
import com.hktf.corelib.jsonbean.UserInfo;
/**
 * 
 * sp 存储的内容进行   用于注册信息  用户登录信息
 * @author 
 *
 */
public class Preferences {
	private static final String  VDI1= "vdi1";
	private static final String  VDI2= "vdi2";
	private static final String  VDI3= "vdi3";
	private static final String  VDI4= "vdi4";
	private static final String  VDI5= "vdi5";
	private static final String  VDI6= "vdi6";
	private Context m_Context;
	private static Preferences m_stInstance;
	private static final String USER = "SystemInfo";
	public static Preferences getInstance(Context context) {
		if (m_stInstance == null)
			m_stInstance = new Preferences(context);

		return m_stInstance;
	}

	private Preferences(Context context) {
		m_Context = context.getApplicationContext();
	}
	
	//注册相关 
	/**
	 * 将sp中保存的pad相关信息封装到PadInfo中	
	 * 
	 * @returnPadInfo
	 */
	private PadInfo getPadInfo(){
		PadInfo padInfo = new PadInfo();
		//TODO 将  PADUUID ,PADMAC ,MODEL,RESOLUTION,DPI,ANDROIDVERSION，KERNELVERSION，BLUETOOTHVERSION
		//PADVERSION  从sp中取出来  添加到 padInfo
		return padInfo;
	}
	/**
	 * 
	 * 将开启app后获取到的机器信息存储到  sp中
	 */
	private void savePadInfo(String PADUUID,String MODEL,String RESOLUTION,String DPI,String ANDROIDVERSION,String KERNELVERSION,String BLUETOOTHVERSION,String PADVERSION){
		//判断传来的是否为空
		//不为空将相应的内同保存到sp中
	}
	
	/**
	 * 
	 * 保存用户注册后的信息
	 * @param userInfo
	 */
	private void saveUserInfo(UserInfo userInfo){
		//从userInfo中取出数据保存到数据  持久化到sp中
	}
	/**
	 * 
	 * 保存vdi信息
	 */
	private void saveBindVdiInfo(){
		SharedPreferences sp = m_Context.getSharedPreferences(USER, 0);
		
	}

	
	/**
	 * 
	 * 判断用户是否登录
	 * @return
	 */
	private boolean isRegistered(){
		//TODO  逻辑从sp 中得到用户的id 如果id为空   用户没有注册
		return false;
	}
	/**
	 * 
	 * 得到用户基本信息
	 * @return
	 */
	private UserInfo getUserInfo(){
		UserInfo userInfo = new UserInfo();
		return null;
		
	}
	

}